package com.qf.smartdevice.dto;

import com.alibaba.druid.util.StringUtils;
import com.qf.smartdevice.pojo.CheckNull;

public class UserDto implements CheckNull {
    private Long id;
    private String username;
    private String password;
    private String type;
    private String status;

    @Override
    public boolean isNull(){
        if (id==null){
            return StringUtils.isEmpty(username) || StringUtils.isEmpty(password);
        }else {
            //如果是更新代表必须所有数据都是空的情况下才是空,有任意一个数据不为空则代表可以更新
            return StringUtils.isEmpty(username) && StringUtils.isEmpty(password) && StringUtils.isEmpty(type) && StringUtils.isEmpty(status);
        }
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getType() {
        type=StringUtils.isEmpty(type)?"0":type;
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getStatus() {
        status=StringUtils.isEmpty(status)?"1":status;
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }
}
